package com.oop.demo11;

public class Test {
    public static void main(String[] args) {
        //没有名字初始化类，不能将实例保存到变量中
        //匿名方法
        new Apple().eat();

        //匿名接口
        new UserService(){
            @Override
            public void hello() {

            }
        };

        UserService userService = new UserService() {
            @Override
            public void hello() {

            }
        };

    }
}

class Apple{
    public void eat(){
        System.out.println("eat");
    }
}

interface UserService{
    void hello();
}

